Skip to content

fix: preserve multi-digit GCP region numbers - #1439

Merged
benoit-cty merged 1 commit into
mlco2:masterfrom
nawaaaaaAaar:fix/gcp-region-numbers
Oct 17, 2026
Merged

benoit-cty merged 1 commit into
mlco2:masterfrom
nawaaaaaAaar:fix/gcp-region-numbers

Conversation

@nawaaaaaAaar

@nawaaaaaAaar nawaaaaaAaar commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1438.

Accept all digits in a GCP region number when extracting it from a zone. The current regex truncates europe-west12 to europe-west1, even though the shipped cloud-impact table has separate entries; this can select the wrong electricity carbon intensity.

Verification on Python 3.12.13:

  • Eight new cases: four multi-digit regressions fail before the fix, four single-digit controls pass.
  • Repository package test command: 688 passed, two skipped, three integration cases deselected, ten subtests passed.
  • All applicable autoflake/isort/Black/flake8 pre-commit hooks passed.

No emissions factors were changed. Cloud metadata tests use mocked provider responses rather than a live GCP account; the package suite uses its existing hardware/API mocks. Web dashboard/API integration and the deliberately excluded visualization module were not exercised.

AI disclosure: autonomously reproduced, implemented, and tested using Perplexity Computer (GPT-6.1). No human review is claimed.

Combined with #1441 and #1443: package suite passed with 695 passes, two skips, three integration cases deselected and twelve subtests passed. PR is open and ready for review; hosted package tests, pre-commit, documentation, packaging and CodeQL require maintainer approval. The PR-size labeler passed but is not a code-verification result.

Copilot AI balanced review requested due to automatic review settings October 5, 2026 16:09
@nawaaaaaAaar
nawaaaaaAaar requested a review from a team as a code owner October 5, 2026 16:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@davidberenstein1957 davidberenstein1957 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks right: [0-9] to [0-9]+ in geography.py is exactly what europe-west12-a needs, and the test covers it. Fixes #1438. The branch is behind master, a rebase before merge would be good.

@codecov

codecov Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.58%. Comparing base (dbcab7d) to head (9a9fe4b).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1439   +/-   ##
=======================================
  Coverage   92.58%   92.58%           
=======================================
  Files          49       49           
  Lines        5341     5341           
=======================================
  Hits         4945     4945           
  Misses        396      396           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@benoit-cty benoit-cty left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks !

@benoit-cty
benoit-cty enabled auto-merge October 17, 2026 15:02
@benoit-cty
benoit-cty force-pushed the fix/gcp-region-numbers branch from a89ef2c to 9a9fe4b Compare October 17, 2026 15:02
@benoit-cty
benoit-cty merged commit cb86f04 into mlco2:master Oct 17, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GCP region parser selects the wrong region for multi-digit region numbers

4 participants